﻿@page "/modal"
@inject IModalService Modal

<h1>Hello, world!</h1>

Welcome to your new app.

<hr class="mb-5" />

<button onclick="@(ShowModal)" class="btn btn-primary">Show Modal</button>

@functions {

    void ShowModal()
    {
        var parameters = new ModalParameters();

        parameters.Add("FormId", 11);

        Modal.OnClose += ModalClosed;
        Modal.Show("Sign Up Form", typeof(SignUpForm), parameters);
    }

    void ModalClosed()
    {
        Console.WriteLine("Modal has closed");
        Modal.OnClose -= ModalClosed;
    }

}
